package cn.gson.crm.controller;

import cn.gson.crm.model.dao.RefundDao;
import cn.gson.crm.model.pojos.Refund;
import cn.gson.crm.model.service.RefundService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/RefundController")
public class RefundController {
    @Autowired
    RefundService refundService;
    @Autowired
    RefundDao refundDao;
    //查询所有
    @RequestMapping("/ContractMethod")
    @ResponseBody
    public Map<String,Object> selectref(HttpSession session, Integer rid, Integer page, Integer size, String jinnian, String qunian, String qiannian){
        return refundService.selectref(session,rid,page,size,jinnian,qunian,qiannian);
    };
    //时间查询
    @RequestMapping("/ContractMethod2")
    @ResponseBody
    public Map<String,Object> selecttiem(HttpSession session, Integer rid, String statr, String endtime,Integer page, Integer size){
        return refundService.selecttiem(session,rid,statr,endtime,page,size);
    };
    //条件查询
    @RequestMapping("/ContractMethod3")
    @ResponseBody
    public Map<String,Object> selectwhere(HttpSession session, Integer rid,String where,Integer page, Integer size){
        return refundService.selectwhere(session,rid,where,page,size);
    };
    @RequestMapping("/ContractMethod4")
    @ResponseBody
    public void savefund(@RequestBody Refund refund){
        refundDao.save(refund);
    }
}
